<?php

namespace Client;

        $view_manager_config = array(
                'display_not_found_reason' => true,
                'display_exceptions'       => true,
                'doctype'                  => 'HTML5',
                'not_found_template'       => 'error/404',
                'exception_template'       => 'error/index',
                'template_map' => array(  
                    'layout/menu'           => __DIR__ . '/../view_mobile/layout/menu.phtml',
                    'layout/top'           => __DIR__ . '/../view_mobile/layout/top.phtml',
                    'layout/layout'           => __DIR__ . '/../view_mobile/layout/layout.phtml',
                    'Client/index/index' => __DIR__ . '/../view_mobile/Client/index/index.phtml', 
                    'error/404'               => __DIR__ . '/../view_mobile/error/404.phtml',
                    'error/index'             => __DIR__ . '/../view_mobile/error/index.phtml',
                ),
                'template_path_stack' => array(
                    __DIR__ . '/../view_mobile',
                ),
            );

$config = array(

    'router' => array(
        'routes' => array(
            
            'home' => array(
                'type' => 'Zend\Mvc\Router\Http\Literal',
                'options' => array(
                    'route'    => '/',
                    'defaults' => array(
                        'controller' => 'Client\Controller\Index',
                        'action'     => 'index',
                    ),
                ),
            ),

            'client' => array(
                'type'    => 'Literal',
                'options' => array(
                    'route'    => '/client',
                    'defaults' => array(
                        '__NAMESPACE__' => 'Client\Controller',
                        'controller'    => 'Index',
                        'action'        => 'index',
                    ),
                ),
                'may_terminate' => true,
                'child_routes' => array(
                    'default' => array(
                        'type'    => 'Segment',
                        'options' => array(
                            'route'    => '/[:controller[/:action]]',
                            'constraints' => array(
                                'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
                                'action'     => '[a-zA-Z][a-zA-Z0-9_-]*',
                            ),
                            'defaults' => array(
                            ),
                        ),
                    ),
                ),
            ),
            'index'=>array(
                'type'=>'segment',
                'options'=>array(
                    'route'=>'/index[/:action]',
                    'constraints'=>array(
                        'action'=>'[a-zA-Z][a-zA-Z0-9_-]*'
                    ),
                    'defaults'=>array(
                        'controller'=>'Client\Controller\index',
                        'action'=>'index'
                    ),
                ),
            ),
            'organization'=>array(
                'type'=>'segment',
                'options'=>array(
                    'route'=>'/organization[/:action][/:id]',
                    'constraints'=>array(
                        'action'=>'[a-zA-Z][a-zA-Z0-9_-]*',
                        'id'     => '[0-9]+',
                    ),
                    'defaults'=>array(
                        'controller'=>'Client\Controller\Organization',
                        'action'=>'index'
                    ),
                ),
            ),
            'order'=>array(
                'type'=>'segment',
                'options'=>array(
                    'route'=>'/order[/:action][/:id]',
                    'constraints'=>array(
                        'action'=>'[a-zA-Z][a-zA-Z0-9_-]*',
                        'id'     => '[0-9]+',
                    ),
                    'defaults'=>array(
                        'controller'=>'Client\Controller\Order',
                        'action'=>'index'
                    ),
                ),
            ),
            'notify'=>array(
                'type'=>'segment',
                'options'=>array(
                    'route'=>'/notify[/:action]',
                    'constraints'=>array(
                        'action'=>'[a-zA-Z][a-zA-Z0-9_-]*',
                        'id'     => '[0-9]+',
                    ),
                    'defaults'=>array(
                        'controller'=>'Client\Controller\Notify',
                        'action'=>'index'
                    ),
                ),
            ),
            'material'=>array(
                'type'=>'segment',
                'options'=>array(
                    'route'=>'/material[/:action][/:material_id]',
                    'constraints'=>array(
                        'action'=>'[a-zA-Z][a-zA-Z0-9_-]*',
                    ),
                    'defaults'=>array(
                        'controller'=>'Client\Controller\Material',
                        'action'=>'index'
                    ),
                ),
            ),
			'feedback'=>array(
				'type'=>'segment',
				'options'=>array(
					'route'=>'/feedback[/:action]',
						'constraints'=>array(
							'action'=>'[a-zA-Z][a-zA-Z0-9_-]*',
						),
						'defaults'=>array(
							'controller'=>'Client\Controller\Feedback',
							'action'=>'index'
						),
				),
			),
            'myScanVoucher'=>array(
                'type'=>'segment',
                'options'=>array(
                    'route'=>'/my/scanVoucher[/:code]',
                    'constraints'=>array(
                        'code'=>'[a-zA-Z0-9_-]*',
                    ),
                    'defaults'=>array(
                        'controller'=>'Client\Controller\My',
                        'action'=>'scanVoucher'
                    ),
                ),
            ),
            'my'=>array(
                'type'=>'segment',
                'options'=>array(
                    'route'=>'/my[/:action][/:id]',
                    'constraints'=>array(
                        'action'=>'[a-zA-Z][a-zA-Z0-9_-]*',
                        'id'     => '[0-9]+',
                    ),
                    'defaults'=>array(
                        'controller'=>'Client\Controller\My',
                        'action'=>'index'
                    ),
                ),
            ),
            'myorder'=>array(
                'type'=>'segment',
                'options'=>array(
                    'route'=>'/myorder[/:action][/:id]',
                    'constraints'=>array(
                        'action'=>'[a-zA-Z][a-zA-Z0-9_-]*',
                        'id'     => '[0-9]+',
                    ),
                    'defaults'=>array(
                        'controller'=>'Client\Controller\MyOrder',
                        'action'=>'index'
                    ),
                ),
            ),
            'mycollection'=>array(
                'type'=>'segment',
                'options'=>array(
                    'route'=>'/mycollection[/:action]',
                    'constraints'=>array(
                        'action'=>'[a-zA-Z][a-zA-Z0-9_-]*',
                    ),
                    'defaults'=>array(
                        'controller'=>'Client\Controller\MyCollection',
                        'action'=>'index'
                    ),
                ),
            ),
            'wechat'=>array(
                'type'=>'segment',
                'options'=>array(
                    'route'=>'/wechat[/:action]',
                    'constraints'=>array(
                        'action'=>'[a-zA-Z][a-zA-Z0-9_-]*',
                    ),
                    'defaults'=>array(
                        'controller'=>'Client\Controller\Wechat',
                        'action'=>'index'
                    ),
                ),
            ),
        ),
    ),
    'service_manager' => array(
        'abstract_factories' => array(
            'Zend\Cache\Service\StorageCacheAbstractServiceFactory',
            'Zend\Log\LoggerAbstractServiceFactory',
        ),
        'factories' => array(
            'translator' => 'Zend\Mvc\Service\TranslatorServiceFactory',
            //
            'Client\Service\VerificationService'   => 'Client\Factory\VerificationServiceFactory',
            // Session
            //'Zend\Session\Config\ConfigInterface' => 'Zend\Session\Service\SessionConfigFactory',
            
        ),
    ),

    'translator' => array(
        'locale' => 'en_US',
        'translation_file_patterns' => array(
            array(
                'type'     => 'gettext',
                'base_dir' => __DIR__ . '/../language',
                'pattern'  => '%s.mo',
            ),
        ),
    ),

    'controllers' => array(
        'invokables' => array(
            'Client\Controller\Index' => Controller\IndexController::class,
            'Client\Controller\Organization' => Controller\OrganizationController::class,
            'Client\Controller\Order' => Controller\OrderController::class,
            'Client\Controller\My' => Controller\MyController::class,
            'Client\Controller\MyOrder' => Controller\MyOrderController::class,
            'Client\Controller\MyCollection' => Controller\MyCollectionController::class,
            'Client\Controller\Material' => Controller\MaterialController::class,
            'Client\Controller\Wechat' => Controller\WechatController::class,
            'Client\Controller\Notify' => Controller\NotifyController::class,
        	'Client\Controller\Feedback' => Controller\FeedbackController::class,
        ),
    ),
    
    'view_manager' => $view_manager_config,

    'view_helpers' => array(
        'invokables' => array(
            'CommonHelper' => 'Client\View\Helper\CommonHelper',
            'OrderHelper' => 'Client\View\Helper\OrderHelper',
        )
    ),
    
    'console' => array(
        'router' => array(
            'routes' => array(
            ),
        ),
    ),
    
    'di' => array(
        'services' => array(
    
        )
    ),
);

return $config;